<template>
  <div style="text-align:center;margin-top:200px" >
      <el-link type="primary">亲~！门店还没创建~请先填写申请信息，审核通过即可开始经营</el-link>
    <el-button type="success " @click="dialogFormVisible = true">申请</el-button>
    
    <el-dialog title="请填写信息" :visible.sync="dialogFormVisible">
      <el-form ref="form" :model="form">
        <el-form-item label="店名" :label-width="formLabelWidth">
          <el-input v-model="form.name" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="营业执照号码" :label-width="formLabelWidth">
          <el-input v-model="form.licenseNum" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="营业执照图片" :label-width="formLabelWidth">
          <el-input v-model="form.licenseImg" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="营业地址" :label-width="formLabelWidth">
          <el-input v-model="form.addr" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="经度" :label-width="formLabelWidth">
          <el-input v-model="form.longitude" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="纬度" :label-width="formLabelWidth">
          <el-input v-model="form.latitude" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="所在城市" :label-width="formLabelWidth">
          <el-input v-model="form.city" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="法人" :label-width="formLabelWidth">
          <el-input v-model="form.legalPerson" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="联系电话" :label-width="formLabelWidth">
          <el-input v-model="form.tel" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="特色" :label-width="formLabelWidth">
          <el-input v-model="form.feature" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="头像" :label-width="formLabelWidth">
          <el-input v-model="form.avatarImg" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="vip等级" :label-width="formLabelWidth">
          <el-input v-model="form.vip" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="佣金比例" :label-width="formLabelWidth">
          <el-input v-model="form.ratio" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="经营范围" :label-width="formLabelWidth">
          <el-input v-model="form.category" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="店员姓名" :label-width="formLabelWidth">
          <el-input v-model="form.assistant.name" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="店员电话" :label-width="formLabelWidth">
          <el-input v-model="form.assistant.tel" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="店员职务" :label-width="formLabelWidth">
          <el-input v-model="form.assistant.job" autocomplete="off"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogFormVisible = false">取 消</el-button>
        <el-button type="primary" @click="subBtn">确 定</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { addStore } from "@/api/admin";
import { mapState } from "vuex";
export default {
  data() {
    return {
      dialogTableVisible: false,
      dialogFormVisible: false,
      form: {
        name: "", //店名
        licenseNum: "", //营业执照号码
        licenseImg: "", //营业执照图片
        addr: "", //地址
        longitude: 0, //经度
        latitude: 0, //纬度
        city: "", //所在城市
        legalPerson: "", //法人
        tel: "", //联系电话
        feature: "", //特色
        avatarImg: "", //头像
        vip: "", //vip等级
        ratio: "", //佣金比例
        category: "", //经营范围
        assistant: //店员
          {
            name: '', //姓名
            tel: 0, //联系电话
            job: '' //职务
          },
          storeId:""
      },
      formLabelWidth: "120px"
    };
  },
      computed:{
         ...mapState("user",["_id"])
    },
    created(){
      this.form.storeId=this._id
    },
  methods: {
    async subBtn() {
     
      this.dialogFormVisible = false;
         addStore(this.form).then(res=>{
          if (res.data.ok) {
            this.$router.go(0);
                  this.$refs["form"].clearValidate();
          }
           
         })


    
    }
  }
};
</script>

<style>
</style>